import request from '@/utils/request'

/**
 * 获取员工列表
 * @param {*} page 当前页码
 * @param {*} size 当前页容量
 * @returns
 */
export const getEmployeesListAPI = (page, size) => {
  return request({
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}
// 删除员工
export const delEmployeesListAPI = (id) => {
  return request.delete(`/sys/user/${id}`)
}

// 新增-员工
export const addEmployeesListAPI = (data) => {
  return request.post('/sys/user', data)
}

// 批量-导入员工
export const batchAddEmployeesList = (data) => {
  return request.post('/sys/user/batch', data)
}

// 更新
export const saveUserDetailByIdAPI = (data) => {
  /* return request.put(`/sys/user/${data.id}`, data) */
  return request({
    method: 'put',
    url: `/sys/user/${data.id}`,
    data
  })
}

// 分配角色接口
export const assignRolesAPI = (data) => {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
